package cn.wxq.daily.empdailymgforserve.controller;
import cn.wxq.daily.empdailymgforserve.domain.VacationAudit;
import cn.wxq.daily.empdailymgforserve.model.Result;
import cn.wxq.daily.empdailymgforserve.model.StatusCode;
import cn.wxq.daily.empdailymgforserve.service.VacationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin //跨越处理
@RestController
@RequestMapping("/vacationAudit")
@Api(value = "VacationAuditController|出勤休假审核")
public class VacationAuditController {
    @Autowired
    private VacationAuditService vacationAuditService;

    @RequestMapping(value = "/insertAuditInfo", method = RequestMethod.POST)
    @ApiOperation(value = "请假加班审核审核")
    public Result insertAuditInfo(VacationAudit vacationAudit ) {
        int row = vacationAuditService.insertAuditInfo(vacationAudit);
        if (row >0) {
            return new Result(true, StatusCode.OK, "审核成功");
        } else {
            return new Result(false, StatusCode.ERROR, "失败");
        }
    }

    @RequestMapping(value = "/insertAuditBusiness", method = RequestMethod.POST)
    @ApiOperation(value = "出差审核审核")
    public Result insertAuditBusiness(VacationAudit vacationAudit ) {
        int row = vacationAuditService.insertAuditBusiness(vacationAudit);
        if (row >0) {
            return new Result(true, StatusCode.OK, "审核成功");
        } else {
            return new Result(false, StatusCode.ERROR, "失败");
        }
    }
}
